use std::marker::PhantomData;
// 1. We have 3 states:
// - Empty
// - Ready
// - Flying
pub struct Empty;
pub struct Ready;
pub struct Flying;

// 2. Finish the Seligh struct definition
// Sleigh<T>
pub struct Sleigh<States> {
    pub states: PhantomData<States>,
}

// 3. Write the Sleigh Implementations for all states
impl Sleigh<Empty> {
    pub fn new() -> Self {
        Self {
            states: PhantomData,
        }
    }

    pub fn load(self) -> Sleigh<Ready> {
        Sleigh {
            states: PhantomData,
        }
    }
}

impl Sleigh<Ready> {
    pub fn take_off(self) -> Sleigh<Flying> {
        Sleigh {
            states: PhantomData,
        }
    }
    pub fn unload(self) -> Sleigh<Empty> {
        Sleigh {
            states: PhantomData,
        }
    }
}

impl Sleigh<Flying> {
    pub fn land(self) -> Sleigh<Ready> {
        Sleigh {
            states: PhantomData,
        }
    }
}

/* // old code, not follow the test
// 1. We have 3 states:
// - Empty
// - Ready
// - Flying
pub enum SleighStates {
    Empty,
    Ready,
    Flying,
}

// 2. Finish the Seligh struct definition
pub struct Sleigh {
    pub states: SleighStates,
}

// 3. Write the Sleigh Implementations for all states
impl Sleigh {
    pub fn new() -> Self {
        Self {
            states: SleighStates::Empty,
        }
    }
    pub fn load(mut self) -> Self {
        match self.states {
            SleighStates::Empty => {
                self.states = SleighStates::Ready;
                self
            }
            _ => self,
        }
    }
    pub fn take_off(mut self) -> Self {
        match self.states {
            SleighStates::Ready => {
                self.states = SleighStates::Flying;
                self
            }
            _ => self,
        }
    }
    pub fn unload(mut self) -> Self {
        match self.states {
            SleighStates::Ready => {
                self.states = SleighStates::Empty;
                self
            }
            _ => self,
        }
    }
    pub fn land(mut self) -> Self {
        match self.states {
            SleighStates::Flying => {
                self.states = SleighStates::Ready;
                self
            }
            _ => self,
        }
    }
}
*/
